package com.xg.serviceOrder.controller;

import com.xg.serviceOrder.entity.UsedCarOrder;
import com.xg.serviceOrder.service.UsedCarOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@RequestMapping("/order")
@Controller
public class UsedCarOrderController {

    @Autowired
    private UsedCarOrderService orderService;

    /**
     * 结算页面
     * 订单信息详情展示
     * @return
     */
    @GetMapping("/index")
    public String index(@RequestParam("carId") Long carId, Model model){
        UsedCarOrder order = orderService.add(carId);
        model.addAttribute("orderInfo",order);
        return "index";
    }

}
